package cn.com.dcsgo.dto;

import cn.com.dcsgo.validation.NotBlankIfNotNull;
import cn.com.dcsgo.validation.ValueOf;
import cn.com.dcsgo.vo.DeliveryModeVO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;

/**
 * 更新商品请求参数
 *
 * @author Dcsgo
 * @since 2025/10/21 10:34
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "更新商品请求参数")
public class ProdUpdateDTO {
    /**
     * 产品ID
     */
    @NotNull(message = "产品ID不能为空")
    @Schema(description = "产品ID")
    private Long prodId;

    /**
     * 商品名称
     */
    @NotBlankIfNotNull(message = "商品名称不能为空或空白字符串")
    @Schema(description = "商品名称")
    private String prodName;

    /**
     * 原价
     */
    @Schema(description = "原价")
    @Min(value = 0, message = "原价不能小于0")
    private BigDecimal oriPrice;

    /**
     * 现价
     */
    @Min(value = 0, message = "现价不能小于0")
    @Schema(description = "现价")
    private BigDecimal price;

    /**
     * 简要描述,卖点等
     */
    @Schema(description = "简要描述,卖点等")
    private String brief;

    /**
     * 详细描述
     */
    @Schema(description = "详细描述")
    private String content;

    /**
     * 商品主图
     */
    @Schema(description = "商品主图")
    private String pic;

    /**
     * 商品图片，以,分割
     */
    @Schema(description = "商品图片，以,分割")
    private String imgs;

    /**
     * 默认是1，表示正常状态, -1表示删除, 0下架
     */
    @ValueOf(value = {"-1", "0", "1"}, message = "状态只能为：1状态, -1删除, 0下架")
    @Schema(description = "默认是1，表示正常状态, -1表示删除, 0下架")
    private Integer status;

    /**
     * 商品分类ID
     */
    @Schema(description = "商品分类ID")
    private Long categoryId;

    /**
     * 总库存
     */
    @Min(value = 0, message = "总库存不能小于0")
    @Schema(description = "总库存")
    private Integer totalStocks;


    /**
     * 运费模板id
     */
    @Schema(description = "运费模板ID")
    private Long deliveryTemplateId;

    /**
     * 配送方式
     */
    @Schema(description = "配送方式")
    private DeliveryModeVO deliveryModeVo;

    /**
     * 活动列表
     */
    @Schema(description = "活动列表")
    private List<Long> tagList;

    /**
     * SKU列表
     */
    @Valid
    @Schema(description = "SKU列表")
    private List<SkuUpdateDTO> skuList;

}
